<!DOCTYPE html>
<html lang="zh">
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<meta http-equiv="X-UA-Compatible" content="ie=edge">
		<title>机构端</title>
        <script src="/Public/static/jquery-2.0.3.min.js"></script>
        <script src="/Public/static/layer/layer.js"></script>
        <link rel="stylesheet" href="__PUBLIC__/Home/css/reset.css">
        <link rel="stylesheet" href="__PUBLIC__/Home/css/style.css">
        <link rel="stylesheet" href="__PUBLIC__/Home/css/page.css" />
	</head>

	<body class="agency_box contentBox pos_rel dpflxr">
		<include file="head" />

		<!-- 2.垂直导航 -->
		<div class="navColumn">
			<a href="{:U('Mechanism/good_index')}" <if condition="$cur eq 商品管理">class="navColumnItem actived dpflxr pos_rel"<else />class="navColumnItem  dpflxr pos_rel"</if> data-type='1'>
				<div class="lineColumn pos_abs"></div>
				<label for="">商品管理</label>
				<div class="rightArrow">
				</div>
			</a>
			<a href="{:U('Mechanism/good_type')}" <if condition="$cur eq 分类管理">class="navColumnItem actived dpflxr pos_rel"<else />class="navColumnItem  dpflxr pos_rel"</if> data-type='2'>
				<div class="lineColumn pos_abs"></div>
				<label for="">分类管理</label>
				<div class="rightArrow">
				</div>
			</a>
			<a href="{:U('Mechanism/exchange_manage')}" <if condition="$cur eq 兑换管理">class="navColumnItem actived dpflxr pos_rel"<else />class="navColumnItem  dpflxr pos_rel"</if> data-type='3'>
				<div class="lineColumn pos_abs"></div>
				<label for="">兑换管理</label>
				<div class="rightArrow">
				</div>
			</a>
		
			
		</div>


		
		<!-- 二 3.2 分类管理  -->
		<div class="contentArea tabPage actived">
			<!-- 3.1.1 分类管理 -->
			<div id="employeeManage">
				<form action="" method="POST">
				<div class="caTitleBox dpflxr">
					<label for="" class="caTitle">分类管理</label>
					<div class="dpflxr hWrapper">
						<input type="text" class="searchBox" name="name1" value="{$name1}" placeholder="请输入分类名称"/>
						
						
						<div><button type="submit"  class="caBtn searchBtn">查询</button></div>
						<div  id="addGoodsCategoryBtn" class="caBtn ">新增分类</div>
					</div>
				</div>
				</form>
				<div class="caTable card">
					<table border="0" width="100%">
							<tbody>
								<tr>
									<th scope="col" width="15%" style="border-top-left-radius: 6px;">ID</th>
								
									<th scope="col" width="35%">分类名称</th>
									
									<th scope="col" width="25%">时间</th>
									
									<th scope="col" width="25%" style="border-top-right-radius: 6px;box-sizing: border-box;" >操作</th>
								</tr>
								<volist name="list" id="item">
								<tr>
							
									
									<td>{$item['id']}</td>
									<td >{$item['name']}</td>
									
									
									<td>{$item['create_time']}</td>
									
									<td style="box-sizing: border-box;" ><a onclick="show({$item['id']})">编辑</a><a>删除</a></td>
								</tr>
								</volist>
							</tbody>
					</table>
				</div>
					<div class="page">
			            {$_page}
			        </div>
			</div>
		
				
			
		</div>
		
		
		
		<!-- [shadowLayer] -->
		<div id="shadowLayer2" class="shadowLayer pos_abs dpflx">
			
			
			<!-- 弹窗1 新增选项 -->
			<div id="addGoodsType" class="addOptionPage pupupWindows pos_rel">
				<div class="pwTitle dpflxr">
					<label>新增分类</label>
					<div id="closeBtn2" class="closeBtn">
						<img src="__PUBLIC__/Home/images/icon_close1.png" >
					</div>
				</div>
				<div class="contentItem dpflxr pos_rel">
					
					<input type="text" name="name" class="inputBox" placeholder="输入分类名称" style=""
						placeholder-style="font-size:16px;line-height:48px;color:#bfa;"/>
					
				</div>
				<input name="id" type="hidden">
				<div  class="pwBtn pos_abs"><label>确定</label></div>
			</div>
		</div>
		<!-- [/shadowLayer] -->
		
		
			
		<script type="text/javascript" src="__PUBLIC__/Home/js/popupWindows.js"></script>
		
	</body>
</html>
<script type="text/javascript">
	function show(bb){
		// console.log(bb);
		var id=bb;
		// alert(id);
		$.ajax({
			url:"{:U('Mechanism/type_name')}",
            data:{id:id},
            type:'POST',
            dataType:'json',
            success:function(data){
            	// console.log(data);
            	$("input[name='name']").val(data.data);
            	$("input[name='id']").val(id);	
            }
		})

		$("#addGoodsCategoryBtn").trigger('click');

	}

	$("body").on('click','.pwBtn',function(){
		var name=$("input[name='name']").val();
		var id=$("input[name='id']").val();
		// console.log(id);return false;
		$.ajax({
			url:"{:U('Mechanism/type_aname')}",
            data:{id:id,name:name},
            type:'POST',
            dataType:'json',
            success:function(data){
            	alert(data.msg);
            	location.replace(location.href);
            }
		})
	})
	$("#addGoodsCategoryBtn").click(function(){
		var name=$("input[name='name']").val('');
		var id=$("input[name='id']").val('');
	})
</script>